
//
//  MyResultMoneyViewController.m
//  VEMoneyPorject
//
//  Created by 陈建 on 2018/9/25.
//  Copyright © 2018年 陈建. All rights reserved.
//

#import "MyResultMoneyViewController.h"
#import "BaseCustomNavView.h"
#import "MyResultClassMoneyTableViewCell.h"
#import "MyTapBiClassGetMoneyViewController.h"
@interface MyResultMoneyViewController ()<BaseCustomNavViewDelegate>
@property (nonatomic, strong) BaseCustomNavView *customNav;

@end

@implementation MyResultMoneyViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isSuccessNet = YES;
    self.tableView.bounces = NO;
    [self.view addSubview:self.customNav];
    [self setupTableViewHeaderView];
    // Do any additional setup after loading the view.
}

- (void)setupTableViewHeaderView{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, Height_NavBar + 100)];
    imageView.userInteractionEnabled = YES;
    imageView.image = [UIImage imageWithColor:kCommonRedColor withRect:imageView.frame];
    self.tableView.tableHeaderView = imageView;
    
    UILabel *resultLable = [[UILabel alloc] init];
    [imageView addSubview:resultLable];
    resultLable.text = [NSString stringWithFormat:@"¥%ld",[CJUserInfoManager sharedManager].currentUserInfo.ACCOUNTBALANCE];
    resultLable.textColor = [UIColor whiteColor];
    resultLable.font = kFont(20.f);
    [resultLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(imageView);
        make.bottom.equalTo(imageView).offset(-20);
    }];
    
}

- (BaseCustomNavView *)customNav{
    if (!_customNav) {
        _customNav = [[BaseCustomNavView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, Height_NavBar)];
        _customNav.isHiddenLeftBtn = NO;
        _customNav.backImageViewColor = [UIColor clearColor];
        _customNav.isHiddenLineView = YES;
        _customNav.titleLable.textColor = kNavViewTitleColor;
        _customNav.title = @"总资产";
        _customNav.titleLable.font = kBoldFont(18);
        _customNav.delegate = self;
    }
    return _customNav;
}

- (void)tapCustomNavLeftBtnClick{
    [self pop];
}

- (NSInteger)cj_numberOfSections{
    return 1;
}

- (NSInteger)cj_numberOfRowsInsection:(NSInteger)section{
    return [self photoArray].count;
}

- (CGFloat)cj_cellHeightAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewAutomaticDimension;
}


- (CJBaseTableViewCell *)cj_cellAtIndexPath:(NSIndexPath *)indexPath{
    MyResultClassMoneyTableViewCell *cell = [MyResultClassMoneyTableViewCell nibWithTableView:self.tableView];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.photoImageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[self photoArray][indexPath.row]]];
    cell.titleLable.text = [self titleArray][indexPath.row];
    return cell;
}

- (void)cj_didSelectCellAtIndexPath:(NSIndexPath *)indexPath cell:(CJBaseTableViewCell *)cell{
    if (indexPath.row == 0) {
        MyTapBiClassGetMoneyViewController *vc = [[MyTapBiClassGetMoneyViewController alloc] init];
        vc.title = @"VE财经";
//        vc.money = 
        [self pushVc:vc];
    }
}

- (NSArray *)photoArray{
    return @[@"VE_logo",@"btc_log",@"yi_logo"];
}
- (NSArray *)titleArray{
    return @[@"VE",@"BTC",@"ETH"];
}

- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    CGFloat offsetY = scrollView.contentOffset.y;
    CGFloat alpha = offsetY / Height_NavBar;
    [self.customNav setupBackImageViewAlffectWithAlpha:alpha];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
